using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Windows.Forms;
using System.IO;

namespace Betarium.PotonEditor
{
	public class UserException : ApplicationException
	{
		protected string m_sFileName;
		protected int m_nFileLine;

		public UserException(string message)
			: base(message)
		{
			StackFrame oStack = new StackFrame(1, true);
			m_sFileName = oStack.GetFileName();
			m_nFileLine = oStack.GetFileLineNumber();
			Source = Path.GetFileName(m_sFileName) + "(" + m_nFileLine + ")";

			Debug.WriteLine("########################################");
			Trace.WriteLine(m_sFileName + "(" + m_nFileLine + "):Exception:" + message);
			Debug.WriteLine("########################################");
		}
		public UserException(string message, Exception excep)
			: base(message, excep)
		{
			StackFrame oStack = new StackFrame(1, true);
			m_sFileName = oStack.GetFileName();
			m_nFileLine = oStack.GetFileLineNumber();
			Source = Path.GetFileName(m_sFileName) + "(" + m_nFileLine + ")";

			Debug.WriteLine("########################################");
			Trace.WriteLine(m_sFileName + "(" + m_nFileLine + "):Exception:" + message);
			Debug.WriteLine("########################################");
		}
	}
}
